import VueRouter from 'vue-router'
import Vue from 'vue'

const Home = () => import('views/home/Home.vue')
const Login = () => import('views/login/Login.vue')
const Main = () => import('views/main/Main.vue')
const UploadBank = () => import('../views/uploadBank/UploadBank')
const BankDetail = () => import('../views/bankDetail/BankDetail')

const DataVisual = () => import('../views/main/dataVisual/DataVisual')
const UserManage = () => import('../views/main/userManage/UserManage')
const InterviewManage = () => import('../views/main/interviewManage/InterviewManage')
const BankManage = () => import('../views/main/bankManage/BankManage')

const UserData = () => import('../views/main/dataVisual/childComps/UserData')
const InterviewData = () => import('../views/main/dataVisual/childComps/InterviewData')
const BankData = () => import('../views/main/dataVisual/childComps/BankData')

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/home'
  },
  {
    path: '/home',
    component: Home 
  },
  {
    path: '/login',
    component: Login
  },
  {
    path: '/main',
    component: Main,
    children: [
      {
        path: '',
        redirect: 'dataVisual'
      },
      {
        path: 'dataVisual',
        component: DataVisual,
        children: [
          {
            path: '',
            redirect: 'userData'
          },
          {
            path: 'userData',
            component: UserData
          },
          {
            path: 'interviewData',
            component: InterviewData
          },
          {
            path: 'bankData',
            component: BankData
          }
        ]
      },
      {
        path: 'userManage',
        component: UserManage
      },
      {
        path: 'interviewManage',
        component: InterviewManage
      },
      {
        path: 'bankManage',
        component: BankManage
      },
    ] 
  },
  {
    path: '/uploadBank',
    component: UploadBank
  },
  {
    path: '/bankDetail/:id',
    component: BankDetail
  },
]

const router = new VueRouter({
  routes,
  mode: 'history'
})

export default router
